package 多态.继承与多态;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 姚东名
 * Date: 2024-06-18
 * Time: 12:14
 */
class B {
    public int Func() {
        System.out.print("B");
        return 0;
    }
}
class D extends B {
    @Override
    public int Func() {
        System.out.print("D");
        return 0;
    }
}
public class Test {
    public static void main(String[] args) {
        B a = new B();
        B b = new D();
        a.Func();
        b.Func();
    }
}
/*
执行结果:
BD
 */

/*
【作业内容】
A.BD
B.DB
C.BB
D.DD
E.编译出错
 */